package api

import (
	"code.byted.org/bytertc/whiteboard_server/biz/service/transcode/callback"
	"code.byted.org/bytertc/whiteboard_server/biz/service/transcode/task"
)

type Header struct {
	Token string `header:"Authorization,required"`
}

type RTMMsg struct {
	Message   string `json:"message"`
	Signature string `json:"signature"`
}

type Response struct {
	Error *Error `json:"error,omitempty"`
}

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type GetReplayQuery struct {
	AppID   string `query:"app_id,required"`
	RoomID  string `query:"room_id,required"`
	BoardId int32  `query:"board_id"`
}

func (g *GetReplayQuery) GetAppId() string {
	return g.AppID
}

func (g *GetReplayQuery) GetRoomId() string {
	return g.RoomID
}

func (g *GetReplayQuery) GetBoardId() int32 {
	return g.BoardId
}

type File struct {
	Bucket    string `json:"bucket"`
	Name      string `json:"name"`
	URL       string `json:"url"`
	StartTime uint64 `json:"startTime"`
	EndTime   uint64 `json:"endTime"`
}

type GetReplayResponse struct {
	Files        []File `json:"files"`
	StartTime    uint64 `json:"startTime"`
	EndEnd       uint64 `json:"endTime"`
	FirstBoardId int32  `json:"firstBoardId"`
}

type GetSnapshotQuery struct {
	ID       string `query:"id,required"`
	AppID    string `query:"app_id,required"`
	RoomID   string `query:"room_id,required"`
	Operator string `query:"operator,required"`
	BoardID  int32  `query:"board_id,required"`
	PageID   string `query:"page_id,required"`
}
type GetSnapshotRequest struct {
	ID       string `json:"id,required"`
	AppID    string `json:"app_id,required"`
	RoomID   string `json:"room_id,required"`
	Operator string `json:"operator,required"`
	BoardID  int32  `json:"board_id,required"`
	PageID   string `json:"page_id,required"`
}

type GetSnapshotResponse struct {
	Message string `json:"message"`
	Binary  bool   `json:"binary"`
}

type GetTokenQuery struct {
	AppID  string `query:"app_id,required"`
	RoomID string `query:"room_id"`
	UserID string `query:"user_id,required"`
}

type GetTokenResponse struct {
	AppID string `json:"app_id"`
	Token string `json:"token"`
}
type CloseWhiteboardRequest struct {
	AppID    string `json:"app_id,required"`
	RoomID   string `json:"room_id,required"`
	Operator string `json:"operator"`
	BoardID  int32  `json:"board_id,required"`
}

func (c *CloseWhiteboardRequest) GetAppId() string {
	return c.AppID
}

func (c *CloseWhiteboardRequest) GetRoomId() string {
	return c.RoomID
}

func (c *CloseWhiteboardRequest) GetBoardId() int32 {
	return c.BoardID
}

type CloseWhiteboardResponse struct {
	Closed bool `json:"closed"`
}

type CreateTranscodeTaskRequest struct {
	AppId           string               `json:"app_id"`
	Operator        string               `json:"operator"`
	Resource        string               `json:"resource"`
	ResourceAttr    task.ResourceAttr    `json:"resource_attr"`
	TranscodeMode   task.TranscodeMode   `json:"transcode_mode"`
	Priority        task.Priority        `json:"priority"`
	TranscodeConfig task.TranscodeConfig `json:"transcode_config,omitempty" binding:"required"`
	StorageConfig   task.StorageConfig   `json:"storage_config,omitempty" binding:"required"`
	PreSignDuration int64                `json:"pre_sign_duration"`
}

type CreateTranscodeTaskResponse struct {
	TaskID string `json:"task_id"`
}

type QueryTranscodeTaskRequest struct {
	AppId    string `query:"app_id"`
	TaskId   string `query:"task_id"`
	Operator string `query:"operator"`
}

type QueryTranscodeTaskResponse struct {
	Status   int    `json:"status"`
	Progress int    `json:"progress"`
	ErrCode  int    `json:"err_code"`
	ErrMsg   string `json:"err_msg"`
}

type GetTranscodeTaskRequest struct {
	AppId         string `query:"app_id"`
	TaskId        string `query:"task_id"`
	Operator      string `query:"operator"`
	NeedThumbnail bool   `query:"need_thumbnail"`
}

type GetTranscodeTaskResponse struct {
	FileName      string           `json:"file_name"`
	FileID        string           `json:"file_id"`
	Width         int              `json:"width"`
	Height        int              `json:"height"`
	TranscodeMode int              `json:"transcode_mode"`
	Images        []callback.Image `json:"images"`
}

type HandleTranscodeExceptionResponse struct {
	Success bool `json:"success"`
}

type CreateDynamicTaskRequest struct {
	AppID    string `json:"app_id"`
	UserID   string `json:"user_id"`
	FileName string `json:"file_name"`
	Size     int64  `json:"size"`
	Resource string `json:"resource"`
}

type CreateDynamicTaskResponse struct {
	TaskID string `json:"task_id"`
}

type WpsCallbackFileDetailRequest struct {
	FileID string `path:"file_id"`
}

type WpsCallbackResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type WpsCallbackFileDetailResponse struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Version    int    `json:"version"`
	Size       int    `json:"size"`
	CreateTime int64  `json:"create_time"`
	ModifyTime int64  `json:"modify_time"`
	CreatorID  string `json:"creator_id"`
	ModifierID string `json:"modifier_id"`
}

type WpsCallbackDownloadRequest struct {
	FileID string `path:"file_id"`
}

type WpsCallbackDownloadResponse struct {
	URL        string            `json:"url"`
	Digest     string            `json:"digest"`
	DigestType string            `json:"digest_type"`
	Headers    map[string]string `json:"headers"`
}

type WpsCallbackPermissionRequest struct {
	AppID  string `path:"app_id"`
	FileID string `path:"file_id"`
	UserID string `path:"user_id"`
}

type WpsCallbackPermissionResponse struct {
	UserID   string `json:"user_id"`
	Read     int    `json:"read"`
	Update   int    `json:"update"`
	Download int    `json:"download"`
	Rename   int    `json:"rename"`
	History  int    `json:"history"`
	Copy     int    `json:"copy"`
	Print    int    `json:"print"`
	Saveas   int    `json:"saveas"`
	Comment  int    `json:"comment"`
}

type WpsCallbackUsersRequest struct {
	UserIDS []string `query:"user_ids"`
}
type WpsCallbackUsersResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type WpsCallbackNotifyRequest struct {
	FileID  string      `json:"file_id"`
	Type    string      `json:"type"`
	Content interface{} `json:"content"`
}

type TranscodeGetResourceRequest struct {
	FileID string `query:"file_id"`
}

type TranscodeGetResourceResponse struct {
	FileID    string  `json:"file_id"`
	Resource  string  `json:"resource"`
	PageCount int     `json:"page_count"`
	FileRatio float64 `json:"file_ratio"`
}

type EnterRoomRequest struct {
	AppID    string `json:"app_id,required"`
	RoomID   string `json:"room_id,required"`
	Operator string `json:"operator,required"`
}

func (e *EnterRoomRequest) GetAppId() string {
	return e.AppID
}
func (e *EnterRoomRequest) GetRoomId() string {
	return e.RoomID
}
func (e *EnterRoomRequest) GetOperator() string {
	return e.Operator
}

type EnterRoomResponse struct {
	Success bool `json:"success"`
}

type QuitRoomRequest struct {
	AppID    string `json:"app_id,required"`
	RoomID   string `json:"room_id,required"`
	Operator string `json:"operator,required"`
}

func (e *QuitRoomRequest) GetAppId() string {
	return e.AppID
}
func (e *QuitRoomRequest) GetRoomId() string {
	return e.RoomID
}
func (e *QuitRoomRequest) GetOperator() string {
	return e.Operator
}

type QuitRoomResponse struct {
	Success bool `json:"success"`
}

type HandleRoomExceptionResponse struct {
	Success bool `json:"success"`
}

type ClearInvalidRoomResponse struct {
	Success bool `json:"success"`
}

type GetConsoleInfoRequest struct {
	AppID    string `json:"AppId,required"`
	Category int    `json:"Category"`
	Operator string `json:"Operator"`
}

func (g *GetConsoleInfoRequest) GetAppId() string {
	return g.AppID
}
func (g *GetConsoleInfoRequest) GetCategory() int {
	return g.Category
}

type GetConsoleInfoResponse struct {
	Transcode ItemInfo `json:"Transcode"`
	Record    ItemInfo `json:"Record"`
}

type ItemInfo struct {
	OpenStatus  int          `json:"OpenStatus"`
	ItemDetails []ItemDetail `json:"ItemDetails"`
}
type ItemDetail struct {
	SpaceType int    `json:"SpaceType"`
	Space     string `json:"Space"`
	Category  int    `json:"Category"`
}

type SetConsoleInfoRequest struct {
	AppID          string `json:"AppId,required"`
	Operator       string `json:"Operator"`
	ParentCategory int    `json:"ParentCategory,required"`
	Category       int    `json:"Category,required"`
	SpaceType      int    `json:"SpaceType,required"`
	Space          string `json:"Space,required"`
	AccountId      string `json:"AccountId"`
	Region         string `json:"Region"`
}

func (s *SetConsoleInfoRequest) GetAppId() string {
	return s.AppID
}
func (s *SetConsoleInfoRequest) GetCategory() int {
	return s.Category
}
func (s *SetConsoleInfoRequest) GetParentCategory() int {
	return s.ParentCategory
}
func (s *SetConsoleInfoRequest) GetSpaceType() int {
	return s.SpaceType
}
func (s *SetConsoleInfoRequest) GetSpace() string {
	return s.Space
}
func (s *SetConsoleInfoRequest) GetAccountId() string {
	return s.AccountId
}
func (s *SetConsoleInfoRequest) GetRegion() string {
	return s.Region
}

type StatusResponse struct {
	Success bool `json:"success"`
}

type SwitchStatusRequest struct {
	AppID      string `json:"AppId,required"`
	Category   int    `json:"Category,required"`
	Operator   string `json:"Operator"`
	OpenStatus int    `json:"OpenStatus,required"`
}

func (s *SwitchStatusRequest) GetAppId() string {
	return s.AppID
}
func (s *SwitchStatusRequest) GetCategory() int {
	return s.Category
}
func (s *SwitchStatusRequest) GetOpenStatus() int {
	return s.OpenStatus
}

type DeleteItemRequest struct {
	AppID    string `json:"AppId,required"`
	Operator string `json:"Operator"`
	Category int    `json:"Category,required"`
}

func (s *DeleteItemRequest) GetAppId() string {
	return s.AppID
}

func (s *DeleteItemRequest) GetCategory() int {
	return s.Category
}

type MonitorConfig struct {
	FreezeCheckInterval int `json:"FreezeCheckInterval"`
	BlankCheckInterval  int `json:"BlankCheckInterval"`
	CrashCheckInterval  int `json:"CrashCheckInterval"`
}

type EventNotifyConfig struct {
	EnableEventNotify bool `json:"EnableEventNotify"`
	StartTimeout      int  `json:"StartTimeout"`
}

type StartVideoRecordRequest struct {
	AppId       string             `json:"AppId,required"`
	BusinessId  string             `json:",omitempty"`
	RoomID      string             `json:"RoomId,required"`
	TaskId      string             `json:"TaskId,required"`
	UserId      string             `json:"UserId"`
	SourceURL   string             `json:"SourceURL"`
	Monitor     *MonitorConfig     `json:"Monitor"`
	EventNotify *EventNotifyConfig `json:"EventNotify"`
}

type StopVideoRecordRequest struct {
	AppId  string `json:"AppId,required"`
	RoomID string `json:"RoomId,required"`
	TaskId string `json:"TaskId,required"`
	UserId string `json:"UserId"`
}

type DemoNameListRequest struct {
	AppID    string `json:"app_id,required"`
	RoomID   string `json:"room_id,required"`
	Operator string `json:"operator"`
	BoardID  int32  `json:"board_id,required"`
}

func (d *DemoNameListRequest) GetAppId() string {
	return d.AppID
}

func (d *DemoNameListRequest) GetRoomId() string {
	return d.RoomID
}

func (d *DemoNameListRequest) GetBoardId() int32 {
	return d.BoardID
}

type DemoNameListResponse struct {
	List []string `json:"list"`
}

type GetBoardInfosRequest struct {
	AppID    string  `json:"app_id,required"`
	RoomID   string  `json:"room_id,required"`
	BoardIDs []int32 `json:"board_ids"`
}

type GetBoardInfosResponse struct {
	Message string `json:"message"`
	Binary  bool   `json:"binary"`
}

type AuthTokenKeyParams struct {
	AppID    string `json:"app_id"`
	RoomID   string `json:"room_id"`
	Operator string `json:"operator"`
}

type CloseRoomRequest struct {
	AppID    string `json:"app_id,required"`
	RoomID   string `json:"room_id,required"`
	Operator string `json:"operator"`
}

func (c *CloseRoomRequest) GetAppId() string {
	return c.AppID
}

func (c *CloseRoomRequest) GetRoomId() string {
	return c.RoomID
}

type CloseRoomResponse struct {
	Closed bool `json:"closed"`
}

type SchedulerJoinRoomRequest struct {
	AppID     string `json:"app_id"`
	RoomID    string `json:"room_id"`
	ServerUID string `json:"server_uid"`
}

type SchedulerJoinRoomResponse struct {
	Success bool `json:"success"`
}

type SchedulerLeaveRoomRequest struct {
	AppID         string `json:"app_id"`
	RoomID        string `json:"room_id"`
	IsMigrate     bool   `json:"is_migrate"`
	ServerVersion int32  `json:"server_version"`
	ServerUID     string `json:"server_uid"`
}

type SchedulerLeaveRoomResponse struct {
}

type SchedulerNotifyChangeServerConfigRequest struct {
	AppID         string `json:"app_id"`
	RoomID        string `json:"room_id"`
	ServerVersion int32  `json:"server_version"`
	ServerUID     string `json:"server_uid"`
}

type SchedulerNotifyChangeServerConfigResponse struct {
}

type WsSendMessageRequest struct {
	ProductID       int32               `json:"ProductID"`
	AppID           int32               `json:"AppID"`
	DeviceID        int64               `json:"DeviceID"`
	UserID          int64               `json:"UserID"`
	Service         int32               `json:"Service"`
	Method          int32               `json:"Method"`
	PayloadEncoding string              `json:"PayloadEncoding"`
	PayloadType     string              `json:"PayloadType"`
	Payload         []byte              `json:"Payload"`
	Extended        map[string]string   `json:"Extended"`
	Header          map[string]string   `json:"Header"`
	HttpHeader      map[string][]string `json:"HttpHeader"`
	ConnUUID        string              `json:"ConnUUID"`
}

type WsSendMessageResponse struct {
}
